package spring_introduction;

import org.springframework.beans.factory.annotation.Autowired;

public class Person {
	private Pet pet;
	private String surname;
	private int age;

	@Autowired
   public Person(Pet pet) {
	   System.out.println("Person bean is created");
	   this.pet = pet;
   }

	//public Person(){System.out.println("Person bean is created");}

	//pet -> Pet -> setPet
	public void setPet(Pet pet){
		System.out.println("Class Person: set pet");
		this.pet = pet;
	}

	public String getSurname() {
		return surname;
	}

	public int getAge() {
		return age;
	}

	public void setSurname(String surname) {
		System.out.println("Class Person: set surname");
		this.surname = surname;
	}

	public void setAge(int age) {
		System.out.println("Class Person: set age");
		this.age = age;
	}

	public void callYourPet() {
		System.out.println("Hello, my lovely Pet!");
		pet.say();
	}
}
